#ifndef BONC_TOOL_H
#define BONC_TOOL_H

#define bonc_free(p)     \
    if (p)               \
    {                    \
        free((void *)p); \
        p = NULL;        \
    }

#define bonc_printf_In(fmt, ...) printf("FUNCTION:%s  LINE=%d  OUTPUT: " fmt "\r\n", __FUNCTION__, __LINE__, ##__VA_ARGS__);
#define STRUCT_MEM_OFFSET(type, member) ((unsigned int)&(((type *)0)->member))
#define STRUCT_PTR_MEM(ptr, type, member) (type *)((char *)ptr - STRUCT_MEM_OFFSET(type, member))
#endif